package com.springdemo;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * Created by liwei.b on 2016/10/19.
 */
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class SpringApplication extends SpringBootServletInitializer implements EmbeddedServletContainerCustomizer {
    public static void main(String[] args) {
        // TODO: 2016/10/19 编写自己的服务业务代码
        org.springframework.boot.SpringApplication.run(SpringApplication.class);
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(SpringApplication.class);
    }
    @Override
    public void customize(ConfigurableEmbeddedServletContainer container) {
        container.setPort(20209);//启动端口号
    }
}
